#ifndef _QUEUE_H_
#define _QUEUE_H_

#include <pthread.h>

typedef struct {
    int front;
    int rear;
    int size;
    int maxsize;
    pthread_mutex_t mutex;
    pthread_cond_t not_empty;
    pthread_cond_t not_full;
    void *data[0];
} queue_t;


queue_t *queue_new(int maxsize);
void     queue_del(queue_t *q);

void     queue_put(queue_t *q, void *data);
void    *queue_get(queue_t *q);
int      queue_size(queue_t *q);

#define qsize   queue_size
#define qput    queue_put
#define qget    queue_get
#define push    queue_put
#define pop     queue_get
#define enque   queue_put
#define deque   queue_get

#endif
